<?php
$this->Html->script(array('plugins/datatables/jquery.dataTables.min'), false);
?>
<?php
echo $this->Form->create('Paginate', array(
	'class' => 'validate',
	'action' => 'index',
	'url' => $this->request->here(false),
	'type' => 'post',
	'inputDefaults' => array('label' => false, 'div' => false)));
echo $this->Form->input('Paginate.task', array('style' => 'display:none;', 'value' => '', 'id' => 'task'));
echo $this->Form->hidden('calculate', array('id' => 'calculate-rank', 'value' => $this->Html->url(array(
		'action' => 'position'
))));
?>
<div class="page-header">
	<div class="icon">
		<span class="ico-layout-7"></span>
	</div>
	<h1>
		<?php echo __('CONTENT'); ?> 
		<small><?php echo __('Bài viết'); ?></small>
	</h1>
	<div class="page-toolbar">
		<div class="btn-group ctr-container">
			<button class="btn btn-primary ctr-add" type="submit">
				<span class="ico-add"></span>
				<?php echo __('Add new'); ?>
			</button>
		</div>
	</div>
</div>

<div class="row-fluid">
	<div class="span12">
		<div class="block">
			<?php
			$continue = array(
				'?' => array('continue' => $this->request->here(false))
			);
			echo $this->Session->flash();
			?>
			<div class="data-fluid">
				<table class="table paginate lcnp" cellpadding="0" cellspacing="0" width="100%">
					<thead>
						<tr>
							<th width="20%"><?php echo __('Tiêu đề'); ?></th>
							<th><?php echo __('Nội dung'); ?></th>
							<th width="80"><?php echo __('Ngày tạo'); ?></th>
							<th width="60"><?php echo __('Ngày sửa'); ?></th>
							<th width="60" class="TAC">Actions</th>
						</tr>
					</thead>
					<tbody>
						<?php foreach ($contents as $content) : ?>
							<tr>
								<td>
									<?php
									echo $this->Html->link($content['Content']['title'], array(
										'action' => 'edit', $content['Content']['id']
									));
									?>
								</td>
								<td>
									<?php echo String::truncate(strip_tags($content['Content']['fulltext'])); ?>
								</td>
								<td>
									<?php echo date('d/m/Y', $content['Content']['created']); ?>
								</td>
								<td>
									<?php echo date('d/m/Y', $content['Content']['updated']); ?>
								</td>
								<td class="table-action">
									<a href="<?php echo $this->Html->url($continue + array('action' => 'edit', $content['Content']['id'])); ?>" class="btn btn-mini green">
										<div class="icon"><span class="ico-pencil"></span></div>
									</a>
									<a href="<?php echo $this->Html->url($continue + array('action' => 'delete', $content['Content']['id'])); ?>" class="btn btn-mini red">
										<div class="icon"><span class="ico-remove"></span></div>
									</a>                                              
								</td>
							</tr>
						<?php endforeach; ?>                         
					</tbody>
				</table>                    
			</div> 
		</div>
	</div>
</div>
<?php echo $this->Form->end(); ?>